home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / Chip_2004-11_cd1.bin / zkuste / dolby / download / dvdlab / DVDlabProRC2b.exe / {app} / Extras / Script / Link Bitmap.talk < prev    next >
Text File  |  2004-03-22  |  2KB  |  60 lines

  1. /*    Link Bitmap 1.0
  2.     by Oscar, 12 Dec 2003
  3.  
  4.     To run this: DROP the Script from Assets to the Object in Menu.
  5.  
  6.     
  7.     This example replace the selected object with the bitmap image of the object it links to
  8.     For example if a button links to Movie it will be replaced by the frame from the movie
  9.     if it links to a menu, it will be replaced by a current snapshot of that menu
  10.     
  11.     Note: because of the bitmap merging, the text will become not-editable after you apply this
  12. */
  13.  
  14. // Get the current menu and selected object when you drag and drop script
  15. // Note: if testing from Script editor make sure you have just one menu opened on desktop,
  16. //       in such case the MenuGetCurSel will return currently opened menu 
  17.  
  18. menu = MenuGetCurSel() 
  19. // VTS menu 1..255, VMG menu 10001..10255 
  20.  
  21. // show the current menu on top of all others
  22. MenuActivate(menu)
  23.  
  24. object= ObjectGetCurSel(menu) 
  25.  
  26. if (object==0) then
  27.     print "No object Selected"
  28.     end
  29. endif
  30.  
  31. // where the object links to ?
  32. nMenu = ObjectGetMenuLink(menu,object) // 0-if no menu link 
  33. nMovie = ObjectGetMovieLink(menu,object) // 0-if no movie link 
  34. nChapter = ObjectGetChapterLink(menu,object) // 0- Movie start 
  35.  
  36. trace "Menu ",nMenu," Movie ",nMovie," Chapter=",nChapter
  37.  
  38. if nMenu>0 then
  39.     // we link to menu !!
  40.     // grab the menu snapshot
  41.     ImgGrabMenuFrame(1,nMenu)
  42.     nW= ImgGetWidth(1) 
  43.     nH= ImgGetHeight(1)
  44.     // don't keep the whole menu in its original size
  45.     ImgResize(1,nW/2,nH/2)
  46.     ImgSetToObject(1,menu,object)
  47. endif
  48.  
  49. if (nMovie>0) then
  50.     // we link to a movie
  51.     //grab a frame from the movie 
  52.     ImgGrabChapterFrame(1,nMovie,nChapter) //nChapter = 0 ->Movie start
  53.     ImgSetToObject(1,menu,object)
  54. endif
  55.  
  56. // no menu link and no movie link - it is just as good as nothing
  57. if (nMovie==0 & nMenu==0) then
  58.     print "The object doesn't link to anything"
  59. endif